package cn.shiwei.org.controller;

import cn.shiwei.basic.util.RequestStatus;
import cn.shiwei.org.domain.Shop;
import cn.shiwei.org.service.IShopService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/shop")
@Api(tags = "店铺接口",description = "店铺接口详细描述")
public class ShopController {

    @Autowired
    private IShopService shopService;

    @PutMapping("/settlement")
    @ApiOperation(value = "添加/修改店铺", notes = "不需要参数")
    private RequestStatus settlement(@RequestBody Shop shop){
        try {
            shopService.save(shop);
            return RequestStatus.me();
        } catch (RuntimeException e) {
            e.printStackTrace();
            return RequestStatus.me().setMessage(e.getMessage());
        } catch (Exception e) {
            e.printStackTrace();
            return RequestStatus.me().setMessage("系统忙");
        }
    }

}
